package patterndemo;

public abstract class Handler {
    //维持对下家的引用
    protected Handler successor;

    public void setSuccessor(Handler successor) {
        this.successor = successor;
    }

    public abstract void handlerRequest(String request);
}

class ConcreteHandler extends Handler {

    @Override
    public void handlerRequest(String request) {
        Boolean b = true;
        if (b) {
            //处理请求
        } else {
            this.successor.handlerRequest(request);
        }
    }
}
